class Solution {
public:
    bool findNumberIn2DArray(vector<vector<int>>& matrix, int target) {
        int num=matrix.size();
        for(int i=0;i< num ;i++){
            int left=0;
            int right=matrix[0].size()-1;
            while(left<=right){
                int mid=left+((right-left)>>2);
                if(matrix[i][mid]<=target){
                    left=mid+1;
                }else{
                    right=mid-1;
                }
            }
            if(right>=0&&matrix[i][right]==target){
                return true;
            }
        }
        return false;
    }
};